4. Priority Queue Using Heap int insert(Event* e) { if( !heap->isFull() ) { heap->insert( e ); return 1; } cout << "insert queue is full." << endl; return 0; }; int full(void){ return heap->isFull(); }; int length() { return heap->getSize(); }; }; http://ecomputernotes.com
5.
6.
7.
8.
9.
10.
11.
12. Disjoint Set ADT The image segmentation problem. http://ecomputernotes.com
13.
14.
Editor's Notes
Start of lecture 33
buildHeap is O ( N ) operation. Each deleteMin is O (log 2 N ). The total running time is thus O ( N + k log 2 N ). If k is small, or O ( N / log 2 N ), then the time required is O ( N ).